<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="{ADMIN_THEME}images/reset.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/system.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/dialog.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/main.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/switchbox.css" rel="stylesheet" type="text/css" />
<link href="{ADMIN_THEME}images/table_form.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{ADMIN_THEME}js/jquery.min.js"></script>
<script type="text/javascript" src="{ADMIN_THEME}js/dialog.js"></script>
<script type="text/javascript" src="{LANG_PATH}lang.js"></script>
<title>admin</title>
</head>
<body style="font-weight: normal;">
<div class="subnav">
	<div class="content-menu ib-a blue line-x">
		<a href="{url('admin/position/')}" class="on"><em>{lang('a-men-31')}</em></a><span>|</span>
		{if admin_auth($userinfo['roleid'], 'position-add')}<a href="{url('admin/position/add/')}"><em>{lang('a-add')}</em></a><span>|</span>{/if}
		{if admin_auth($userinfo['roleid'], 'position-cache')}<a href="{url('admin/position/cache')}"><em>{lang('a-cache')}</em></a>{/if}
	</div>
	<div class="bk10"></div>
	<div class="table-list">
		<form action="" method="post" name="myform">
		<table width="100%">
		<thead>
		<tr>
			<th width="20" align="right"><input name="deletec" id="deletec" type="checkbox" onClick="setC()" /></th>
			<th width="26" align="left">ID </th>
			<th width="150" align="left">{lang('a-name')}</th>
			<th width="55" align="left">{lang('a-pos-2')}</th>
			<th width="80" align="center">{lang('a-pos-3')}</th> 
			<th align="left">{lang('a-option')}</th>
		</tr>
		</thead>
		<tbody>
		{loop $list $t}
		<tr>
			<td align="right"><input name="del_{$t[posid]}" type="checkbox" class="deletec" /></td>
			<td align="left">{$t['posid']}</td>
			<td align="left">{$t['name']}</td>
			<td align="left">{if $t['catid']}{lang('a-con-29')}{else}{lang('a-pos-4')}{/if}</td>
			<td align="center">{$t['maxnum']}</td>
			<td align="left">
			<?php $del = url('admin/position/del/',array('posid'=>$t['posid']));?>
			{if admin_auth($userinfo['roleid'], 'position-list')}<a href="{url('admin/position/list',array('posid'=>$t['posid']))}">{lang('a-pos-0')}</a> | {/if}
			{if admin_auth($userinfo['roleid'], 'position-edit')}<a href="{url('admin/position/edit',array('posid'=>$t['posid']))}">{lang('a-edit')}</a> | {/if}
			{if admin_auth($userinfo['roleid'], 'position-del')}<a href="javascript:;" onClick="if(confirm('{lang('a-confirm')}')){ window.location.href='{$del}'; }">{lang('a-del')}</a> | {/if}
			<a href="javascript:;" onClick="getViewData({$t['posid']});">{lang('a-pos-5')}</a>
			</td>
		</tr>
		{/loop}
		<tr>
			<td colspan="7" align="left">&nbsp;
			<input {if !admin_auth($userinfo['roleid'], 'position-del')}disabled{/if} type="submit" class="button" value="{lang('a-del')}" name="submit" onclick="return confirm_del()" />&nbsp;</td>
		</tr>   
		</tbody>
		</table>
		</form>
	</div>
</div>
<script type="text/javascript">
function confirm_del() {
    if (confirm('{lang('a-confirm')}')) { 
		return true; 
	} else {
	    return false;
	}
}
function setC() {
	if($("#deletec").attr('checked')) {
		$(".deletec").attr("checked",true);
	} else {
		$(".deletec").attr("checked",false);
	}
}
function getViewData(posid) {
	var url = '{url("admin/position/ajaxview/",array("posid"=>""))}'+posid;
	window.top.art.dialog(
	    {id:"ajaxview", okVal:fc_lang[6], cancelVal:fc_lang[7], iframe:url, title:'{lang('a-pos-5')}', width:'300', height:'120', lock:true,
		button: [
            {
				name: '{lang('a-copy')}',
				callback: function () {
					 var d = window.top.art.dialog({id:'ajaxview'}).data.iframe;
			         var c = d.document.getElementById('position_'+posid).value;
					 copyToClipboard(c);
					 return false;
				},
				focus: true
            }, {
                name: '{lang('a-close')}'
            }
        ]
		
		}
	);
}

function copyToClipboard(meintext) {
    if (window.clipboardData){
        window.clipboardData.setData("Text", meintext);
    } else if (window.netscape){
        try {
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
        } catch (e) {
            alert("{lang('a-att-18')}"); 
		} 
        var clip = Components.classes['@mozilla.org/widget/clipboard;1'].
        createInstance(Components.interfaces.nsIClipboard);
        if (!clip) return;
        var trans = Components.classes['@mozilla.org/widget/transferable;1'].
        createInstance(Components.interfaces.nsITransferable);
        if (!trans) return;
        trans.addDataFlavor('text/unicode');
        var len = new Object();
        var str = Components.classes["@mozilla.org/supports-string;1"].
        createInstance(Components.interfaces.nsISupportsString);
        var copytext=meintext;
        str.data=copytext;
        trans.setTransferData("text/unicode",str,copytext.length*2);
        var clipid=Components.interfaces.nsIClipboard;
        if (!clip) return false;
        clip.setData(trans,null,clipid.kGlobalClipboard);
    }
    alert("{lang('a-att-19')}");
    return false;
}
</script>
</body>
</html>